home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / Page.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-16  |  1.2 KB  |  51 lines

  1. /* Copyright (C) 1992-2001 by Digital Mars. $Revision: 1.1.1.1 $ */
  2. #if __SC__ || __RCC__
  3. #pragma once
  4. #endif
  5.  
  6. #ifndef __PAGE_H
  7. #define __PAGE_H 1
  8.  
  9. #if __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. #if __INTSIZE == 4
  14. #define __BF
  15. #else
  16. #define __BF far
  17. #endif
  18.  
  19. #define __PGOFF        sizeof(unsigned short)
  20.  
  21. #pragma pack(1)
  22.  
  23. struct Pageheader
  24. {
  25.     unsigned short pagesize;
  26.     unsigned short maxsize;
  27.     unsigned short allocp;
  28.     unsigned short bassize;
  29.     unsigned short baslnk;
  30. };
  31.  
  32. #pragma pack()
  33.  
  34. #define PAGEOVERHEAD    sizeof(struct Pageheader)
  35.  
  36. unsigned __cdecl page_calloc(void __BF *baseptr,unsigned size);
  37. unsigned __cdecl page_malloc(void __BF *baseptr,unsigned size);
  38. unsigned __cdecl page_realloc(void __BF *baseptr,unsigned p, unsigned nbytes);
  39. int __cdecl page_free(void __BF *baseptr,unsigned p);
  40. unsigned __cdecl page_maxfree(void __BF *baseptr);
  41. unsigned __cdecl page_initialize(void __BF *baseptr,unsigned pagesize);
  42. #define page_size(baseptr,p) \
  43.     (*(unsigned short __BF *)((char __BF *)(baseptr) + (p) - __PGOFF) - __PGOFF)
  44. #define page_toptr(baseptr,p)    (void __BF *)((char __BF *)(baseptr) + (p))
  45.  
  46. #if __cplusplus
  47. }
  48. #endif
  49.  
  50. #endif
  51.